import React, { Component } from 'react';
import { Route, Link, Switch } from 'react-router-dom';
import SideBar from '../../../component/SideBar';
import Header from '../../../component/Header';
import {rootRouters} from './router'

class App extends Component {
  constructor(props) {
    super(props);
    this.state = { current: 'home' };
  }

  handleClick(e) {
    console.log('click ', e, this.state);
    this.setState({
      current: e.key
    });
  }

  render() {
    return <div>
      <Header></Header>
      <SideBar></SideBar>
      <Switch>
        {
          rootRouters.map((route,index)=>{
            return (
              <Route
                key={index}
                path={route.path}
                component={route.component}
                exact={route.exact}/>
            )
          })
        }
      </Switch>
    </div>;
  }
}

export default App;
